<h1><?php echo $fund['name'] ?></h1>
<ul id="breadcrumb">
	<li>หมายเหตุประกอบงบการเงิน</li>	
</ul>
<div id="content">
<div class="search">
	<form aaction="child" method="get">
		<label>ปีงบประมาณ </label><?php echo form_dropdown('year', get_year_option('2550'),(!empty($_GET['year']))?$_GET['year']:''); ?>
		<?php if(level_data('view')): ?>
		&nbsp;&nbsp;<label>หน่วยงาน </label><?php echo form_dropdown('agency_id', get_agency_option($fund['id']),(!empty($_GET['agency_id']))?$_GET['agency_id']:'','','ทั้งหมด'); ?>
		<?php endif; ?>
		&nbsp;<input type="submit" value="<?php echo lang('search'); ?>" class="button" />
	</form>
</div>
<div class="head">
		<p><?php echo $fund['name'] ?></p>
		<p>หมายเหตุประกอบงบการเงิน</p>
		<p>ประจำปี  ตั้งแต่ <?php echo db_to_th($start_date) ?>  ถึง  <?php echo db_to_th($end_date) ?></p>
	</div>
<table class="list">
	<tr>
		<th style="text-align:left; padding-left:10px;"><strong>หมายเหตุที่ 1 นโยบายบัญชีที่สำคัญ</strong></th>
	</tr>
	<tr>
		<td style="line-height:20px;">
			<?php echo nl2br(get_one('detail','ps','fund_id',$fund['id'])) ?>
		</td>
	</tr>
</table>
<br />
<table class="list">
	<tr>
		<th style="text-align:left; padding-left:10px;"><strong>หมายเหตุที่ 2 เงินสดและรายการเทียบเท่าเงินสด</strong></th>
		<th><strong><?php echo (!empty($_GET['year']))?$_GET['year']:date('Y')+543 ?></strong></th>
		<th><strong><?php echo (!empty($_GET['year']))?$_GET['year']:date('Y')+542 ?></strong></th>
	</tr>
	<?php $sum = 0?>
	<?php $sum2 = 0?>
	<?php foreach($money as $item): ?>
	<tr>
		<td>    <?php echo $item['name'] ?></td>
		<td class="num"><?php echo ($item['price']>0)?number_format($item['price'],2):'-' ?></td>
		<td class="num"><?php echo ($item['price2']>0)?number_format($item['price2'],2):'-' ?></td>
	</tr>
	<?php $sum += $item['price']?>
	<?php $sum2 += $item['price2']?>
	<?php endforeach; ?>
	<tr>
		<td></td>
		<td class="num"><?php echo ($sum>0)?number_format($sum,2):'-' ?></td>
		<td class="num"><?php echo ($sum2>0)?number_format($sum2,2):'-' ?></td>
	</tr>
</table>
<br />
<table class="list">
	<tr>
		<th style="text-align:left; padding-left:10px;"><strong>หมายเหตุที่ 3 ครุภัณฑ์</strong></th>
		<th><strong><?php echo (!empty($_GET['year']))?$_GET['year']:date('Y')+543 ?></strong></th>
		<th><strong><?php echo (!empty($_GET['year']))?$_GET['year']:date('Y')+542 ?></strong></th>
	</tr>
	<?php $sum = 0?>
	<?php $sum2 = 0?>
	<?php foreach($karupan as $item): ?>
	<tr>
		<td>    <?php echo $item['name'] ?></td>
		<td class="num"><?php echo ($item['price']>0)?number_format($item['price'],2):'-' ?></td>
		<td class="num"><?php echo ($item['price2']>0)?number_format($item['price2'],2):'-' ?></td>
	</tr>
	<?php 
		$sum += $item['price'];
		$sum2 += $item['price2'];
	?>
	<?php endforeach; ?>
	<?php foreach($karupan_delete as $item): ?>
	<tr>
		<td>    หัก <?php echo $item['name'] ?></td>
		<td class="num"><?php echo ($item['price']>0)?number_format($item['price'],2):'-' ?></td>
		<td class="num"><?php echo ($item['price2']>0)?number_format($item['price2'],2):'-' ?></td>
	</tr>
	<?php 
		$sum -= $item['price'];
		$sum2 -= $item['price2'];
	?>
	<?php endforeach; ?>
	<tr>
		<td></td>
		<td class="num"><?php echo ($sum>0)?number_format($sum,2):'-' ?></td>
		<td class="num"><?php echo ($sum2>0)?number_format($sum2,2):'-' ?></td>
	</tr>
</table>
<br />
<table class="list">
	<thead>
	<tr>
		<th style="text-align:left; padding-left:10px;"><strong>หมายเหตุที่ 4 ค่าใช้จ่ายในการดำเนินงาน</strong></th>
		<th><strong><?php echo (!empty($_GET['year']))?$_GET['year']:date('Y')+543 ?></strong></th>
		<th><strong><?php echo (!empty($_GET['year']))?$_GET['year']:date('Y')+542 ?></strong></th>
	</tr>
	</thead>
	<?php $sum = 0?>
	<?php $sum2 = 0?>
	<?php foreach($work as $item): ?>
	<tr>
		<td>    <?php echo $item['name'] ?></td>
		<td class="num"><?php echo ($item['price']>0)?number_format($item['price'],2):'-' ?></td>
		<td class="num"><?php echo ($item['price2']>0)?number_format($item['price2'],2):'-' ?></td>
	</tr>
	<?php $sum += $item['price']?>
	<?php $sum2 += $item['price2']?>
	<?php endforeach; ?>
	<tr>
		<td></td>
		<td class="num"><?php echo ($sum>0)?number_format($sum,2):'-' ?></td>
		<td class="num"><?php echo ($sum2>0)?number_format($sum2,2):'-' ?></td>
	</tr>
</table>
</div>